package com.lzs.adx.web.modules.adx.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.lzs.adx.commmon.service.impl.CrudServiceImpl;
import com.lzs.adx.web.modules.adx.dao.TbCpaListDao;
import com.lzs.adx.web.modules.adx.dto.TbCpaListDTO;
import com.lzs.adx.web.modules.adx.entity.TbCpaListEntity;
import com.lzs.adx.web.modules.adx.entity.WphOrderEntity;
import com.lzs.adx.web.modules.adx.service.TbCpaListService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;

import java.util.Map;

/**
 * 
 *
 * @author wangzhijun 825400558@qq.com
 * @since 1.0.0 2025-02-23
 */
@Service
public class TbCpaListServiceImpl extends CrudServiceImpl<TbCpaListDao, TbCpaListEntity, TbCpaListDTO> implements TbCpaListService {

    @Override
    public QueryWrapper<TbCpaListEntity> getWrapper(Map<String, Object> params){
        String id = (String)params.get("id");
        String stime = (String)params.get("stime");
        String etime = (String)params.get("etime");
        String pid = (String)params.get("pid");

        QueryWrapper<TbCpaListEntity> wrapper = new QueryWrapper<>();
        wrapper.eq(StringUtils.isNotBlank(id), "id", id);
        wrapper.ge(StringUtils.isNotBlank(stime) ,"day",stime);
        wrapper.le(StringUtils.isNotBlank(etime) ,"day",etime);
        wrapper.eq(StringUtils.isNotBlank(pid), "pid", pid);

        wrapper.orderByDesc("day").orderByDesc("use_num");

        return wrapper;
    }


}